<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>模板</title>
    <link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet" media="all">
</head>
<body>

<table class="layui-hide" id="demo" lay-filter="test"></table>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script th:src="@{/leshu/lsyl.js}"></script>
<script th:inline="javascript"> var ctx = [[@{
    /}]]; </script>
<!-- 日期模板 -->
<script type="text/html" id="toolbarDate">
    <div class="layui-inline">
        <label class="layui-form-label ">日期</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input layui-input-date">
        </div>
        <button type="button" lay-event="submits" class="layui-btn layui-btn-primary">查询</button>
    </div>
</script>

<script th:inline="javascript">
    var json = JSON.parse(sessionStorage.getItem("json"));

    var range = $.tableTemplate.dateValue("range"),
        startDate = $.tableTemplate.dateValue("start"),
        endDate = $.tableTemplate.dateValue('end');


    console.log(sessionStorage.getItem("sql"))

    layui.use(['table', 'laydate','layer'], function ()  {
        layui.layer.msg('此页面提示不支持查询');
        var option = $.extend({
            elem: '#demo'
            , data: []
            , even: true
            , url: ctx + 'yf/reports/verification' //数据接口
            , method: 'post'
            , where: {
                sql: sessionStorage.getItem("sql"),
                column: sessionStorage.getItem("column"),
                hospitalId: sessionStorage.getItem("hospital_ids"),
                startDate: startDate,
                endDate: endDate
            }
            , parseData: $.tableTemplate.parseData(),
            done: $.tableTemplate.done(json.toolbar)
        }, json);
        layui.table.render(option);

        layui.table.on('toolbar(test)', function (obj) {
            var checkStatus = layui.table.checkStatus(obj.config.id);
            console.log(checkStatus)
            switch (obj.event) {
                case 'submits':
                    layui.table.reload('demo', {
                        where: {
                            startDate: startDate,
                            endDate: endDate
                        }
                    });
                    break;
                case 'PROMPT':
                        layui.layer.msg('此报表为当前管辖范围医院所有数据');
                    break;
            }
        });



    });


</script>
</body>
</html>